import { Router } from 'hyper-express';
import requireUser from '../../../middlewares/auth/requireUser';
import cache from '../../../middlewares/cache';
import rowLevelPermission from '../../../middlewares/auth/rowLevelPermission';
//#region AutoCreateCode
import { uctooEntityController } from '../../../controllers';
const uctooentityRouter = new Router();
const entityController = new uctooEntityController();

uctooentityRouter.post('/add', requireUser, entityController.add);
uctooentityRouter.post('/edit', requireUser, rowLevelPermission('uctoo/entity'), entityController.edit);
uctooentityRouter.post('/del', requireUser, rowLevelPermission('uctoo/entity'), entityController.delete);

//For getting entity with permission control
uctooentityRouter.get('/:id', requireUser,  rowLevelPermission('uctoo/entity'), entityController.getSingle);
uctooentityRouter.get('/:limit/:page', requireUser,  rowLevelPermission('uctoo/entity'), entityController.getMany);
uctooentityRouter.get('/:limit/:page/:skip', requireUser,  rowLevelPermission('uctoo/entity'), entityController.getMany);

//#endregion AutoCreateCode
export default uctooentityRouter;
